package nz.ac.massey.cs.se400_2013.ass3.plugin;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class StudentEditorUi extends BasicEditor{

	private JTextField nameEntry;
	private JLabel nameLabel;
	private JTextField firstNameEntry;
	private JLabel firstNameLabel;
	
	public StudentEditorUi(){
		nameEntry = new JTextField();
		nameLabel = new JLabel("name");
		firstNameEntry = new JTextField();
		firstNameLabel = new JLabel("first name");
		GridBagLayout layout = new GridBagLayout();
		this.setLayout(layout);
		this.addName();
		this.addFirstName();
		this.addChangeHandlers();
	}
	
	public void addName(){
		GridBagConstraints constraints = new GridBagConstraints();
		constraints.anchor = GridBagConstraints.SOUTHWEST;
		constraints.gridx = 0;
		constraints.gridy = 0;
		constraints.ipadx = 100;
		
		this.add(this.nameLabel, constraints);
		
		constraints.gridx = 1;
		constraints.gridy = 0;
		constraints.fill = GridBagConstraints.HORIZONTAL;
		this.add(this.nameEntry, constraints);
	}
	
	public void setFirstName(String text){
		this.firstNameEntry.setText(text);
	}
	
	public String getName(){
		return this.nameEntry.getText();
	}
	
	public void setName(String name){
		this.nameEntry.setText(name);
	}
	
	public String getFirstName(){
		return this.firstNameEntry.getText();
	}
	
	public void addFirstName(){
		GridBagConstraints constraints = new GridBagConstraints();
		constraints.anchor = GridBagConstraints.SOUTHWEST;
		constraints.gridx = 0;
		constraints.gridy = 1;
		constraints.ipadx = 100;
		
		this.add(this.firstNameLabel, constraints);
		
		constraints.gridx = 1;
		constraints.gridy = 1;
		this.add(this.firstNameEntry, constraints);
	}
	
}
